package com.luzhikun.upload_1;

import javax.servlet.*;
import java.io.IOException;

public class CharactorPostFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
        // 设置响应的字符集为UTF-8
        request.setCharacterEncoding("UTF-8");
        // 设置响应的字符集为UTF-8
        response.setContentType("text/html;charset=UTF-8");
        chain.doFilter(request, response);
    }

    @Override
    public void destroy() {

    }
}
